package com.badminton.web.enums;

/**
 * @Author: peng.chen
 * @CreateTime: 2025-02-13
 * @Description: 用户类型枚举
 * @Version: 1.0.0
 */
public enum UserTypeEnum {
    ADMIN(0, "管理员"),
    USER(1, "普通用户");

    ;
    private Integer code;
    private String desc;

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    UserTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    public static UserTypeEnum getUserTypeEnumByCode(Integer code) {
        for (UserTypeEnum userTypeEnum : UserTypeEnum.values()) {
            if (userTypeEnum.getCode().equals(code)) {
                return userTypeEnum;
            }
        }
        return null;
    }
}
